<div class="sm-rightPanel">
    <div class="layui-anim layui-anim-upbit">
        <div class="layui-form sm-form-lg" action="">
            <div id="url_form">
                <h2>
                    添加公众号
                </h2>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i>*</i>公众号类型</label>
                    <div class="layui-input-block">
                        <select id="accType" name="accType" lay-verify="required">
                            <option value="">请选择级别</option>
                            <option value="1">服务号</option>
                            <option value="2">订阅号</option>
                        </select>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i>*</i>公众号名称</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" lay-verify="required" placeholder="公众号名称" class="layui-input">
                        <p class="form-tips">
                            请填写gh开头的原始id
                        </p>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i>*</i>公众号原始ID</label>
                    <div class="layui-input-block">
                        <input type="text" name="account" lay-verify="required" placeholder="字母或者数字"
                               class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">URL</label>
                    <div class="layui-input-block">
                        <input type="text" name="title" placeholder="无须输入，自动生成" class="layui-input" readonly>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">Token</label>
                    <div class="layui-input-block">
                        <input type="text" name="email" placeholder="无须输入，自动生成" class="layui-input" readonly>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i>*</i>AppID</label>
                    <div class="layui-input-block">
                        <input type="text" name="appid" placeholder="AppID" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i>*</i>AppSecret</label>
                    <div class="layui-input-block">
                        <input type="text" name="appsecret" placeholder="AppSecret" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i>*</i>消息条数</label>
                    <div class="layui-input-inline">
                        <input type="text" name="msgcount" value="5" class="layui-input" readonly>
                    </div>
                    <span class="tips">(回复图文消息条数)</span>
                </div>
            </div>

            <div class="layui-form-item">
                <div class="layui-input-block" style="text-align: center;">
                    <button type="button" class="layui-btn" lay-submit lay-filter="add_account" style="width: 300px;">
                        立即提交
                    </button>
                </div>
            </div>
        </div>
    </div>
</div>
<script>
    layui.use(['form'], function () {
        var form = layui.form;
        var $ = layui.$;

        form.render();
        //监听提交
        form.on('submit(add_account)', function (data) {
            smartAui.ajax({
                url: '/wxcms/getUrl',
                data: data.field,
                loading: true,
                success: function (result) {
                    if (result.success) {
                        getCountStatus(result.data.id)
                        jumpByHash("/wx/url/url");
                        layer.msg("保存成功");
                    } else {
                        layer.msg("保存失败");
                    }
                }
            });
            return false;
        });
    });
</script>